// 获取 localStorage 信息
export const getItem = name => {
  if (!name) return
  let value = localStorage.getItem(name)
  let result
  try {
    result = JSON.parse(value)
  } catch (e) {
    result = value
  }
  return result
}

// 设置 localStorage
export const setItem = (name, value) => {
  if (!name) return
  if (typeof value !== 'string') {
    value = JSON.stringify(value)
  }
  localStorage.setItem(name, value)
}

// 删除 localStorage
export const removeItem = (name) => {
  if (!name) return
  localStorage.removeItem(name)
}

// 清空 localStorage
export const clearAll = () => {
  localStorage.clear()
}

export const localIP = 'http://10.16.10.55:28019'
// export const localIP = 'http://192.168.1.10:28019'